package com.funcourse.demo.model.repo;

import com.funcourse.demo.model.CompeteRoom;
import com.funcourse.demo.model.CompeteRoom.RoomStatus;
import com.funcourse.demo.model.CompeteRoom.RoomType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

public interface CompeteRoomRepo extends MongoRepository<CompeteRoom,String> {

  Page<CompeteRoom> findByOwnerId(String ownerId,Pageable pageable);

  Page<CompeteRoom> findByRoomStatusAndRoomTypeAndDeadLineLessThan(RoomStatus roomStatus,
      RoomType roomType,Long time,Pageable pageable);

  Page<CompeteRoom> findByRoomStatusAndRoomTypeAndStartTimeLessThan(RoomStatus roomStatus,
                                                                   RoomType roomType,Long time,Pageable pageable);
}
